<!--回到顶部 -->
<template>
  <el-backtop
    @click="goTop"
  >
    <div class="demo">UP</div>
  </el-backtop>
</template>

<script>
export default {
  name: "Gotop",
  methods: {
    goTop() {
      //返回浏览器最顶端  --有的支持documentElement有的支持body
      document.documentElement.scrollTop = document.body.scrollTop = 0;
    },
  },
};
</script>

<style>
.demo {
  height: 100%;
  width: 100%;
  background-color: #f2f5f6;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.12);
  text-align: center;
  line-height: 40px;
  color: #1d953f;
}
</style>